// config.cpp
#include "config.h"

Config::Config(QObject *parent) : QObject(parent) {
    m_settings = new QSettings("Sokoban", "Config", this);
    initDefaults();
}

Config::~Config() {
    save();
    delete m_settings;
}

void Config::initDefaults() {
    m_windowSize = QSize(800, 600);
    m_cellSize = 50;
}

void Config::save() {
    m_settings->setValue("window/size", m_windowSize);
    m_settings->setValue("game/cellSize", m_cellSize);
}

void Config::load() {
    m_windowSize = m_settings->value("window/size", m_windowSize).toSize();
    m_cellSize = m_settings->value("game/cellSize", m_cellSize).toInt();
}
